package com.winter.Controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winter.model.FinOnline;
import com.winter.service.FinOnlineService;
import com.winter.util.Result;

@RestController
@RequestMapping("v1/finOnline")
public class FinOnlineController {

    @Resource
    FinOnlineService finOnlineService;

    /**
     * 报价线上列表
     */
    @GetMapping("/fin_list")
    public Result finOnlineList(Integer pageNumber, Integer pageSize, String direction, String pattern, String deadline, String profit, String userNo, String sortName, String sort) {
        return finOnlineService.queryPageList(pageNumber, pageSize, direction, pattern, deadline, profit, userNo, sortName, sort);

    }

    /**
     * 新增线上报价
     */
    @PostMapping("/insertFinOnline")
    public Result insertFinOnline(@RequestBody FinOnline finOnline) {
        return finOnlineService.insertFin(finOnline);
    }

    /**
     * 修改线上报价
     */
    @PutMapping("/updateFinOnline")
    public Result updateFinOnline(@RequestBody FinOnline finOnline) {
        return finOnlineService.updateFinOnline(finOnline);
    }


    /**
     * 根据Id查询 发布的线上报价信息
     */
    @GetMapping("/queryFinId")
    public Result queryFinId(Long id, String userNo) {
        return finOnlineService.queryFinId(id, userNo);
    }

}
